CREATE TABLE [dbo].[TCCOMP_PAGO]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[TI_COMP_PAGO] [dbo].[TD_VC_003] NOT NULL,
[NU_COMP_PAGO] [dbo].[TD_VC_008] NOT NULL,
[CO_PROV] [dbo].[TD_VC_020] NOT NULL,
[CO_MONE] [dbo].[TD_VC_003] NOT NULL,
[FE_COMP_PAGO] [dbo].[TD_DT_001] NOT NULL,
[FA_TIPO_CAMB] [dbo].[TD_NU_015_006] NOT NULL CONSTRAINT [DF__TCCOMP_PA__FA_TI__1F98B2C1] DEFAULT ((1.000)),
[IM_TOTA] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TCCOMP_PA__IM_TO__208CD6FA] DEFAULT ((0)),
[NU_ANNO] [dbo].[TD_VC_004] NULL,
[NU_MESE] [dbo].[TD_VC_002] NULL,
[DE_OBSE] [dbo].[TD_VC_100] NOT NULL,
[NU_CUOT] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TCCOMP_PA__NU_CU__2180FB33] DEFAULT ((0)),
[CO_UNID_CONC] [dbo].[TD_VC_003] NOT NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NOT NULL,
[ST_FECH_VENC] [dbo].[TD_VC_001] NOT NULL,
[NU_DIAS_VENC] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TCCOMP_PA__NU_DI__22751F6C] DEFAULT ((0)),
[TI_SITU] [dbo].[TD_VC_003] NOT NULL,
[ST_CONT] [dbo].[TD_VC_001] NULL,
[NU_PROC] [dbo].[TD_IN_001] NULL CONSTRAINT [DF__TCCOMP_PA__NU_PR__236943A5] DEFAULT ((0)),
[ST_ALQU] [dbo].[TD_VC_001_SINO] NULL CONSTRAINT [DF__TCCOMP_PA__ST_AL__245D67DE] DEFAULT ('N'),
[CO_CLIE] [dbo].[TD_VC_020] NULL,
[NU_ASTO] [dbo].[TD_VC_010] NULL,
[ST_REPA] [dbo].[TD_VC_001_SINO] NULL CONSTRAINT [DF__TCCOMP_PA__ST_RE__2645B050] DEFAULT ('N'),
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TCCOMP_PA__CO_US__282DF8C2] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TCCOMP_PA__FE_US__29221CFB] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TCCOMP_PA__CO_US__2A164134] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TCCOMP_PA__FE_US__2B0A656D] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TCCOMP_PAGO] WITH NOCHECK ADD CONSTRAINT [CK__TCCOMP_PA__ST_AL__25518C17] CHECK NOT FOR REPLICATION (([ST_ALQU]='N' OR [ST_ALQU]='S'))
GO
ALTER TABLE [dbo].[TCCOMP_PAGO] WITH NOCHECK ADD CONSTRAINT [CK__TCCOMP_PA__ST_RE__2739D489] CHECK NOT FOR REPLICATION (([ST_REPA]='N' OR [ST_REPA]='S'))
GO
ALTER TABLE [dbo].[TCCOMP_PAGO] ADD CONSTRAINT [PK__TCCOMP_P__17DCF2A706ADD4BD] PRIMARY KEY CLUSTERED  ([CO_EMPR], [TI_COMP_PAGO], [NU_COMP_PAGO]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TCCOMP_PAGO] ADD CONSTRAINT [FK__TCCOMP_PA__CO_EM__019F06DD] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_TESO] ([CO_EMPR])
GO
ALTER TABLE [dbo].[TCCOMP_PAGO] ADD CONSTRAINT [FK__TCCOMP_PAGO__00AAE2A4] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
ALTER TABLE [dbo].[TCCOMP_PAGO] ADD CONSTRAINT [FK__TCCOMP_PAGO__7FB6BE6B] FOREIGN KEY ([CO_EMPR], [TI_COMP_PAGO]) REFERENCES [dbo].[TTTIPO_COPA] ([CO_EMPR], [TI_COMP_PAGO])
GO
